import Vue from 'vue'
import VueRouter from 'vue-router'
import Err from '@/views/err/route'
import Indexroute from '@/views/main/route'
import Login from '@/views/login/route'
Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: {
      name: "Guifu"
    }

  },
  {
    path: '/guifu',
    name: 'Guifu',
    component: () => import("@/views/guifu/guifu.vue")
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
  },
  {
    path:"/search",
    name:"search",
    component:()=>import("@/views/search/search.vue")
  },
  {
    path:"/city",
    name:"city",
    component:()=>import("@/views/city/city.vue")
  },
  ...Err,
  ...Indexroute,
  ...Login,
  {
    path: "*",
    redirect: "/404"
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
